import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entities/user';
import { Track } from './entities/track';
import { ApiLog } from './entities/apiLog';

@Module({
  imports: [
    TypeOrmModule.forRoot({
      type: 'mysql',
      host: 'rm-bp1hq6040th2u1b426o.mysql.rds.aliyuncs.com',
      port: 3306, // 默认MySQL端口，请根据需要修改
      username: 'zrsql',
      password: 'Wuzhennan676',
      database: 'zr',
      entities: [User, Track, ApiLog],
      // entities: [__dirname + '/../**/*.entities.ts'],
      synchronize: true, // 仅用于开发环境
    }),
  ],
  exports: [TypeOrmModule],
})
export class DatabaseModule {}
